import math

n = 100
ST = [[0 for _ in range(int(math.log(n)) + 1)] for _ in range(n)]
for i in range(n):
    ST[i][0] = min(i + 1, n - 1)
steps = [
    (1, 5),
    (3, 7),
    (10, 15),
    (12, 16),
    (16, 18),
    (32, 64),
    (65, 99)
]
for begin, end in steps:
    ST[begin][0] = max(ST[begin][0], end)
for i in range(n - 1, -1, -1):
    for j in range(int(math.log(n)) + 1):
        ST[i][j] = max(ST[ST[i][j - 1]][j - 1], ST[i][j])
print()


def getMaxBit(num):
    val = 0
    if not num: return 0
    while num:
        num >>= 1
        val += 1
    return val - 1


# 试求7到19的最短距离
start = 7
end = 19
between = getMaxBit(end - start)
print(between)
